#include <iostream>
#include <algorithm>
#include <iterator>
#include <vector>

class Generator
{
public:
  Generator()
    : counter(0), step(1)
  { }

  Generator(int c, int s)
    : counter(c), step(s)
  { }

  int
  operator()()
  {
    counter += step;
    return (counter - step);
  }

private:
  int counter;
  int step;
};

int main()
{
  std::vector<int> V1(10);
  std::vector<int> V2;
  std::vector<int> V3(10);

  std::generate(V1.begin(), V1.end(), Generator(2, 3));
  V2 = V1;

  std::cout << "V1: ";
  std::copy(V1.begin(), V1.end(), std::ostream_iterator<int>(std::cout, " "));
  std::cout << std::endl;

  std::cout << "V2: ";
  std::copy(V2.begin(), V2.end(), std::ostream_iterator<int>(std::cout, " "));
  std::cout << std::endl;

  std::transform(V1.begin(), V1.end(), V2.begin(), V3.begin(), std::plus<int>());

  std::cout << "V3: ";
  std::copy(V3.begin(), V3.end(), std::ostream_iterator<int>(std::cout, " "));
  std::cout << std::endl;
}
